<?PHP

/*  CRONES -> Lista di finti crone eseguiti il giorno schedulato o al primo accesso seguente */

function runCrone($name, $params) {
	
	global $_CONF;
	
	switch($name) {
		
		case 'ExcelDumpDelete':
			$excelFile = $params[0];
			$filePath = $_SERVER['DOCUMENT_ROOT'].$_CONF->get('CONFIG>ADMIN>ADMININC.nodeValue').$excelFile;
			$return = array(
				"status" => "OK", 
				"error_detail" => "",
				"title" => "ExcelDumpDelete",
				"data" => $filePath
			);
			_log("'$croneName' details: FilePath: $filePath");
			if(unlink($filePath)) $return['status'] = "OK";
			else {
				$return['status'] = "KO";
				$return['error_detail'] = "File not found";
			}
			return $return;
			break;
			
		case 'CSVDumpDelete':
			$csvFile = $params[0];
			$filePath = $_SERVER['DOCUMENT_ROOT'].$_CONF->get('CONFIG>ADMIN>ADMININC.nodeValue').$csvFile;
			$return = array(
				"status" => "OK", 
				"title" => "CSVDumpDelete",
				"data" => $filePath
			);
			if(unlink($filePath)) $return['status'] = "OK";
			else $return['status'] = "KO";
			return $return;
			break;
		
	}
	
}

?>